home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 85 / CD Actual 85 Febrero 2004.iso / Experto / Apache / apache_2.0.48-win32-x86-no_ssl.msi / Data.Cab / F252592_mod_vhost_alias.html.en < prev    next >
Encoding:
Extensible Markup Language  |  2003-05-29  |  16.6 KB  |  311 lines

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
  4.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  5.               This file is generated from xml source: DO NOT EDIT
  6.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  7.       -->
  8. <title>mod_vhost_alias - Apache HTTP Server</title>
  9. <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
  10. <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
  11. <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
  12. <link href="../images/favicon.ico" rel="shortcut icon" /></head>
  13. <body>
  14. <div id="page-header">
  15. <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
  16. <p class="apache">Apache HTTP Server Version 2.0</p>
  17. <img alt="" src="../images/feather.gif" /></div>
  18. <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
  19. <div id="path">
  20. <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="../">Version 2.0</a> > <a href="./">Modules</a></div>
  21. <div id="page-content">
  22. <div id="preamble"><h1>Apache Module mod_vhost_alias</h1>
  23. <div class="toplang">
  24. <p><span>Available Languages: </span><a href="../en/mod/mod_vhost_alias.html" title="English"> en </a></p>
  25. </div>
  26. <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides for dynamically configured mass virtual
  27. hosting</td></tr>
  28. <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  29. <tr><th><a href="module-dict.html#ModuleIdentifier">ModuleáIdentifier:</a></th><td>vhost_alias_module</td></tr>
  30. <tr><th><a href="module-dict.html#SourceFile">SourceáFile:</a></th><td>mod_vhost_alias.c</td></tr></table>
  31. <h3>Summary</h3>
  32.  
  33.     <p>This module creates dynamically configured virtual hosts, by
  34.     allowing the IP address and/or the <code>Host:</code> header of
  35.     the HTTP request to be used as part of the pathname to
  36.     determine what files to serve. This allows for easy use of a
  37.     huge number of virtual hosts with similar configurations.</p>
  38.     
  39.     <div class="note"><h3>Note</h3>
  40.       <p>If <code class="module"><a href="../mod/mod_alias.html">mod_alias</a></code> or <code class="module"><a href="../mod/mod_userdir.html">mod_userdir</a></code> are
  41.       used for translating URIs to filenames, they will override the
  42.       directives of <code class="module"><a href="../mod/mod_vhost_alias.html">mod_vhost_alias</a></code> described below. For
  43.       example, the following configuration will map <code>
  44.       /cgi-bin/script.pl</code> to <code>
  45.       /usr/local/apache2/cgi-bin/script.pl</code> in all cases:</p>
  46.  
  47.       <div class="example"><p><code>
  48.         ScriptAlias /cgi-bin/ /usr/local/apache2/cgi-bin/<br />
  49.         VirtualScriptAlias /never/found/%0/cgi-bin/
  50.       </code></p></div>
  51.     </div>
  52. </div>
  53. <div id="quickview"><h3 class="directives">Directives</h3>
  54. <ul id="toc">
  55. <li><img alt="" src="../images/down.gif" /> <a href="#virtualdocumentroot">VirtualDocumentRoot</a></li>
  56. <li><img alt="" src="../images/down.gif" /> <a href="#virtualdocumentrootip">VirtualDocumentRootIP</a></li>
  57. <li><img alt="" src="../images/down.gif" /> <a href="#virtualscriptalias">VirtualScriptAlias</a></li>
  58. <li><img alt="" src="../images/down.gif" /> <a href="#virtualscriptaliasip">VirtualScriptAliasIP</a></li>
  59. </ul>
  60. <h3>Topics</h3>
  61. <ul id="topics">
  62. <li><img alt="" src="../images/down.gif" /> <a href="#interpol">Directory Name Interpolation</a></li>
  63. <li><img alt="" src="../images/down.gif" /> <a href="#examples">Examples</a></li>
  64. </ul><h3>See also</h3>
  65. <ul class="seealso">
  66. <li><code class="directive"><a href="../mod/core.html#usecanonicalname">UseCanonicalName</a></code></li>
  67. <li><a href="../vhosts/mass.html">Dynamically configured mass 
  68.     virtual hosting</a></li>
  69. </ul></div>
  70. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  71. <div class="section">
  72. <h2><a name="interpol" id="interpol">Directory Name Interpolation</a></h2>
  73.     
  74.  
  75.     <p>All the directives in this module interpolate a string into
  76.     a pathname. The interpolated string (henceforth called the
  77.     "name") may be either the server name (see the <code class="directive"><a href="../mod/core.html#usecanonicalname">UseCanonicalName</a></code>
  78.     directive for details on how this is determined) or the IP
  79.     address of the virtual host on the server in dotted-quad
  80.     format. The interpolation is controlled by specifiers inspired
  81.     by <code>printf</code> which have a number of formats:</p>
  82.  
  83. <table>
  84.  
  85. <tr><td><code>%%</code></td>
  86. <td>insert a <code>%</code></td></tr>
  87.  
  88. <tr><td><code>%p</code></td>
  89. <td>insert the port number of the virtual host</td></tr>
  90.  
  91. <tr><td><code>%N.M</code></td>
  92. <td>insert (part of) the name</td></tr>
  93.      
  94. </table>
  95.  
  96.     <p><code>N</code> and <code>M</code> are used to specify
  97.     substrings of the name. <code>N</code> selects from the
  98.     dot-separated components of the name, and <code>M</code>
  99.     selects characters within whatever <code>N</code> has selected.
  100.     <code>M</code> is optional and defaults to zero if it isn't
  101.     present; the dot must be present if and only if <code>M</code>
  102.     is present. The interpretation is as follows:</p>
  103.  
  104.     <table>
  105.       <tr><td><code>0</code></td>
  106.       <td>the whole name</td></tr>
  107.  
  108.       <tr><td><code>1</code></td>
  109.       <td>the first part</td></tr>
  110.  
  111.       <tr><td><code>2</code></td>
  112.       <td>the second part</td></tr>
  113.  
  114.       <tr><td><code>-1</code></td>
  115.       <td>the last part</td></tr>
  116.  
  117.       <tr><td><code>-2</code></td>
  118.       <td>the penultimate part</td></tr>
  119.  
  120.       <tr><td><code>2+</code></td>
  121.       <td>the second and all subsequent parts</td></tr>
  122.  
  123.       <tr><td><code>-2+</code></td>
  124.       <td>the penultimate and all preceding parts</td></tr>
  125.  
  126.       <tr><td><code>1+</code> and <code>-1+</code></td>
  127.       <td>the same as <code>0</code></td></tr>
  128.     </table>
  129.  
  130.     <p>If <code>N</code> or <code>M</code> is greater than the number
  131.     of parts available a single underscore is interpolated. </p>
  132.  
  133. </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  134. <div class="section">
  135. <h2><a name="examples" id="examples">Examples</a></h2>
  136.     
  137.  
  138.     <p>For simple name-based virtual hosts you might use the
  139.     following directives in your server configuration file:</p>
  140.  
  141.     <div class="example"><p><code>
  142.       UseCanonicalName    Off<br />
  143.       VirtualDocumentRoot /usr/local/apache/vhosts/%0
  144.     </code></p></div>
  145.  
  146.     <p>A request for
  147.     <code>http://www.example.com/directory/file.html</code> will be
  148.     satisfied by the file
  149.     <code>/usr/local/apache/vhosts/www.example.com/directory/file.html</code>.
  150.     </p> 
  151.  
  152.     <p>For a very large number of virtual hosts it is a good idea
  153.     to arrange the files to reduce the size of the
  154.     <code>vhosts</code> directory. To do this you might use the
  155.     following in your configuration file:</p>
  156.  
  157.     <div class="example"><p><code>
  158.       UseCanonicalName    Off<br />
  159.       VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2
  160.     </code></p></div>
  161.  
  162.     <p>A request for
  163.     <code>http://www.domain.example.com/directory/file.html</code>
  164.     will be satisfied by the file
  165.     <code>/usr/local/apache/vhosts/example.com/d/o/m/domain/directory/file.html</code>.</p>
  166.  
  167.     <p>A more even spread of files can be achieved by hashing from the
  168.     end of the name, for example: </p>
  169.  
  170. <div class="example"><p><code>
  171.     VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.-1/%2.-2/%2.-3/%2
  172. </code></p></div>
  173.  
  174.     <p>The example request would come from
  175.     <code>/usr/local/apache/vhosts/example.com/n/i/a/domain/directory/file.html</code>.</p>
  176.  
  177.     <p>Alternatively you might use: </p>
  178.  
  179. <div class="example"><p><code>
  180.     VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2.4+
  181. </code></p></div>
  182.  
  183.     <p>The example request would come from
  184.     <code>/usr/local/apache/vhosts/example.com/d/o/m/ain/directory/file.html</code>.</p>
  185.  
  186.     <p>For IP-based virtual hosting you might use the following in
  187.     your configuration file:</p>
  188.  
  189.     <div class="example"><p><code>
  190.       UseCanonicalName DNS<br />
  191.       VirtualDocumentRootIP /usr/local/apache/vhosts/%1/%2/%3/%4/docs<br />
  192.       VirtualScriptAliasIP  /usr/local/apache/vhosts/%1/%2/%3/%4/cgi-bin
  193.     </code></p></div>
  194.  
  195.     <p>A request for
  196.     <code>http://www.domain.example.com/directory/file.html</code>
  197.     would be satisfied by the file
  198.     <code>/usr/local/apache/vhosts/10/20/30/40/docs/directory/file.html</code>
  199.     if the IP address of <code>www.domain.example.com</code> were
  200.     10.20.30.40. A request for
  201.     <code>http://www.domain.example.com/cgi-bin/script.pl</code> would
  202.     be satisfied by executing the program
  203.     <code>/usr/local/apache/vhosts/10/20/30/40/cgi-bin/script.pl</code>.</p>
  204.  
  205.     <p>If you want to include the <code>.</code> character in a
  206.     <code>VirtualDocumentRoot</code> directive, but it clashes with
  207.     a <code>%</code> directive, you can work around the problem in
  208.     the following way:</p>
  209.  
  210. <div class="example"><p><code>
  211.     VirtualDocumentRoot /usr/local/apache/vhosts/%2.0.%3.0
  212. </code></p></div>
  213.  
  214.     <p>A request for
  215.     <code>http://www.domain.example.com/directory/file.html</code>
  216.     will be satisfied by the file
  217.     <code>/usr/local/apache/vhosts/domain.example/directory/file.html</code>.</p>
  218.      
  219.     <p>The <code class="directive"><a href="../mod/mod_log_config.html#logformat">LogFormat</a></code>
  220.     directives <code>%V</code> and <code>%A</code> are useful
  221.     in conjunction with this module.</p>
  222. </div>
  223. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  224. <div class="directive-section"><h2><a name="VirtualDocumentRoot" id="VirtualDocumentRoot">VirtualDocumentRoot</a> <a name="virtualdocumentroot" id="virtualdocumentroot">Directive</a></h2>
  225. <table class="directive">
  226. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Dynamically configure the location of the document root
  227. for a given virtual host</td></tr>
  228. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>VirtualDocumentRoot <em>interpolated-directory</em>|none</code></td></tr>
  229. <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>VirtualDocumentRoot none</code></td></tr>
  230. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
  231. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  232. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_vhost_alias</td></tr>
  233. </table>
  234.  
  235.     <p>The <code class="directive">VirtualDocumentRoot</code> directive allows you to
  236.     determine where Apache will find your documents based on the
  237.     value of the server name. The result of expanding
  238.     <em>interpolated-directory</em> is used as the root of the
  239.     document tree in a similar manner to the <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> directive's argument. 
  240.     If <em>interpolated-directory</em> is <code>none</code> then
  241.     <code class="directive">VirtualDocumentRoot</code> is turned off. This directive 
  242.     cannot be used in the same context as <code class="directive"><a href="#virtualdocumentrootip">VirtualDocumentRootIP</a></code>.</p>
  243.  
  244.  
  245. </div>
  246. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  247. <div class="directive-section"><h2><a name="VirtualDocumentRootIP" id="VirtualDocumentRootIP">VirtualDocumentRootIP</a> <a name="virtualdocumentrootip" id="virtualdocumentrootip">Directive</a></h2>
  248. <table class="directive">
  249. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Dynamically configure the location of the document root
  250. for a given virtual host</td></tr>
  251. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>VirtualDocumentRootIP <em>interpolated-directory</em>|none</code></td></tr>
  252. <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>VirtualDocumentRootIP none</code></td></tr>
  253. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
  254. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  255. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_vhost_alias</td></tr>
  256. </table>
  257.  
  258. <p>The <code class="directive">VirtualDocumentRootIP</code> directive is like the
  259.     <code class="directive"><a href="#virtualdocumentroot">VirtualDocumentRoot</a></code>
  260.     directive, except that it uses the IP address of the server end
  261.     of the connection for directory interpolation instead of the server
  262.     name.</p>
  263.  
  264. </div>
  265. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  266. <div class="directive-section"><h2><a name="VirtualScriptAlias" id="VirtualScriptAlias">VirtualScriptAlias</a> <a name="virtualscriptalias" id="virtualscriptalias">Directive</a></h2>
  267. <table class="directive">
  268. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Dynamically configure the location of the CGI directory for
  269. a given virtual host</td></tr>
  270. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>VirtualScriptAlias <em>interpolated-directory</em>|none</code></td></tr>
  271. <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>VirtualScriptAlias none</code></td></tr>
  272. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
  273. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  274. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_vhost_alias</td></tr>
  275. </table>
  276.  
  277.     <p>The <code class="directive">VirtualScriptAlias</code> directive allows you to
  278.     determine where Apache will find CGI scripts in a similar
  279.     manner to <code class="directive"><a href="#virtualdocumentroot">VirtualDocumentRoot</a></code> does for other documents. It matches
  280.     requests for URIs starting <code>/cgi-bin/</code>, much like <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code>
  281.     <code>/cgi-bin/</code> would.</p>
  282.  
  283.  
  284. </div>
  285. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  286. <div class="directive-section"><h2><a name="VirtualScriptAliasIP" id="VirtualScriptAliasIP">VirtualScriptAliasIP</a> <a name="virtualscriptaliasip" id="virtualscriptaliasip">Directive</a></h2>
  287. <table class="directive">
  288. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Dynamically configure the location of the cgi directory for
  289. a given virtual host</td></tr>
  290. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>VirtualScriptAliasIP <em>interpolated-directory</em>|none</code></td></tr>
  291. <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>VirtualScriptAliasIP none</code></td></tr>
  292. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
  293. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  294. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_vhost_alias</td></tr>
  295. </table>
  296.  
  297.     <p>The <code class="directive">VirtualScriptAliasIP</code> directive is like the
  298.     <code class="directive"><a href="#virtualscriptalias">VirtualScriptAlias</a></code>
  299.     directive, except that it uses the IP address of the server end
  300.     of the connection for directory interpolation instead of the server
  301.     name.</p>
  302.  
  303.     
  304. </div>
  305. </div>
  306. <div class="bottomlang">
  307. <p><span>Available Languages: </span><a href="../en/mod/mod_vhost_alias.html" title="English"> en </a></p>
  308. </div><div id="footer">
  309. <p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p>
  310. <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
  311. </body></html>